package com.example.a2209_shop.database

import android.app.Application
import androidx.room.Room

/**
 * 数据库工具类
 */
class DataBaseUtils {
    companion object{
        private lateinit var appDataBase: AppDataBase//定义数据库
        //实例化数据库
        fun init(application: Application){
            appDataBase = Room.databaseBuilder(application,AppDataBase::class.java,"2209a.db")
                .allowMainThreadQueries()
                .build()
        }
        //对外暴露数据库
        fun getDb() = appDataBase
    }
}